package cn.jjaw.command.worker.command;

/**
 * 命令的执行结果
 */
public class ExecuteResult {
    /**
     * 此命令是否有对应的执行器执行
     */
    public boolean hasExecute;
    /**
     * 此命令是否有被正常执行，有对应的执行器，并且执行过程中没有发生异常
     */
    public boolean isExecuted;
    /**
     * 执行的返回结果，如果返回值为void 或者 为null 则为null
     */
    public Object returnObj;
    /**
     * 如果在执行的过程中发生异常，则返回异常
     */
    public Throwable returnThrowable;

    public ExecuteResult(boolean hasExecute, boolean isExecuted, Object returnObj, Throwable returnThrowable) {
        this.hasExecute = hasExecute;
        this.isExecuted = isExecuted;
        this.returnObj = returnObj;
        this.returnThrowable = returnThrowable;
    }

    @Override
    public String toString() {
        return "ExecuteResult{" +
                "hasExecute=" + hasExecute +
                ", isExecuted=" + isExecuted +
                ", returnObj=" + returnObj +
                ", returnThrowable=" + returnThrowable +
                '}';
    }
}
